package xyz.labradormm.spider.controller;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.labradormm.spider.domain.dto.DownloadVideoDto;
import xyz.labradormm.spider.domain.dto.Result;
import xyz.labradormm.spider.domain.vo.DownloadVideoResultVo;
import xyz.labradormm.spider.service.impl.TaskService;

/**
 * @author huanghaojian
 * @description
 * @date 2023-12-10 1:50
 */
@RequestMapping("task")
@RestController
@Slf4j
public class TaskController {


    @Autowired
    private TaskService taskService;

    /**
     * 下载youtube视频(单个)
     * @param dto
     * @return
     */
    @PostMapping("youtube/download")
    public Result<DownloadVideoResultVo> youtubeDownload(@RequestBody DownloadVideoDto dto) {
        DownloadVideoResultVo resultVo = taskService.youtubeDownload(dto);
        return Result.success().setData(resultVo);
    }


}
